package com.atguigu.gulimall.order.service;

import com.atguigu.common.vo.mq.SecKillOrderTo;
import com.atguigu.gulimall.order.vo.*;
import com.baomidou.mybatisplus.extension.service.IService;
import com.atguigu.common.utils.PageUtils;
import com.atguigu.gulimall.order.entity.OrderEntity;

import java.util.Map;
import java.util.concurrent.ExecutionException;

/**
 * 订单
 *
 * @author gyhe10
 * @email gyhe10@163.com
 * @date 2024-08-17 12:48:48
 */
public interface OrderService extends IService<OrderEntity> {

    PageUtils queryPage(Map<String, Object> params);

    /**
     * 获取订单确认页需要的数据
     * @return
     */
    OrderConfirmVo confirmOrder() throws ExecutionException, InterruptedException;

    /**
     * 提交订单
     * @param submitVo
     * @return
     */
    SubmitOrderResponseVo submitOrder(OrderSubmitVo submitVo);

    /**
     * 根据订单号查询订单信息
     * @param orderSn
     * @return
     */
    OrderEntity getOrderByOrderSn(String orderSn);

    /**
     * 关闭订单
     * @param orderEntity
     */
    void closeOrder(OrderEntity orderEntity);

    /**
     * 获取当前订单的支付信息
     * @param orderSn
     * @return
     */
    PayVo getOrderPayInfo(String orderSn);

    /**
     * 分页查询当前用户所有订单及其订单项数据
     * @param params
     * @return
     */
    PageUtils getOrderListWithOrderItems(Map<String, Object> params);

    /**
     * 处理支付宝的支付结果
     * @param vo
     * @return
     */
    String handlePayResult(PayAsyncVo vo);

    /**
     * 根据订单号修改订单状态
     * @param orderSn
     * @param code
     */
    void updateOrderStatus(String orderSn, Integer code);

    /**
     * 创建秒杀订单
     * @param secKillOrderTo
     */
    void createSeckillOrder(SecKillOrderTo secKillOrderTo);
}

